//
//  ADUtils.swift
//  YYHWidget
//
//  Created by Li Dong on 2022/4/20.
//

import UIKit


class ADUtils: NSObject {

    @objc static let shared = ADUtils()
    
    override init() {
        super.init()
        checkAdStatus()
    }
    
    let LookAdKey = "LookAdKey"
    var times = 0
    
    @objc var finishTask: Bool {
        return times >= 3
//        return true
    }
    
    func reloadWidget() {
        
    }
    
    func checkAdStatus() {
        times = UserDefaults.standard.integer(forKey: LookAdKey)
        if times >= 3 {
            reloadWidget()
        }
    }
    
    func updateAdTimes() {
        times += 1
        UserDefaults.standard.set(times, forKey: LookAdKey)
        UserDefaults.standard.synchronize()
        if times >= 3 {
            reloadWidget()
        }
    }
}
